<template>
  <!-- 订单号请求记录 -->
  <el-dialog
    title="订单号请求记录"
    width="900px"
    :visible.sync="showTask"
    :close-on-click-modal="false"
    @close="handleClose"
    :modal-append-to-body="false"
  >
    <el-table
      :data="tableList"
      v-loading="loading"
      :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
      highlight-current-row
      stripe
      style="border: 1px solid #dfe6ec"
    >
      <el-table-column prop="bankName" label="银行名称"></el-table-column>
      <el-table-column
        prop="status"
        label="请求状态"
        align="center"
        :formatter="formatTd"
      >
        <template slot-scope="scope">
          {{ scope.row.status == 'S' ? '成功' : '失败' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="请求时间"
        align="center"
        :formatter="formatTd"
      ></el-table-column>
      <!-- 表格数据为空时，页面显示 -->
      <div slot="empty" v-show="isShow">
        <emptyTable emptyText="暂无相关信息"></emptyTable>
      </div>
    </el-table>
    <Pagination
      ref="pagination"
      @getList="getTableList"
      :filterField="filterField"
      :requestUrl="requestUrl"
    ></Pagination>
    <!-- <div slot="footer" class="dialog-footer">
      <el-button class="cancel" @click="handleClose" v-sdc>取消</el-button>
      <el-button type="primary" class="save" :loading="taskLoading" @click="handleClose"  v-sdc>确定</el-button>
    </div> -->
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      showTask: false,
      filterField: {
        interfaceName: 'Salary.Query',
        requestInfo: this.childData,
      },
      requestUrl: 'api-su/bankdata/loglist',
      tableList: [],
      loading: false,
      taskLoading: false,
      isShow: false,
    }
  },
  props: {
    showTaskProp: {
      type: Boolean,
      default: false,
    },
    ids: {
      type: Array,
      default() {
        return []
      },
    },
    childData: {
      type: String,
      required: true,
    },
  },
  watch: {
    showTaskProp(val) {
      this.showTask = val
      if (val) {
        this.$nextTick(function () {
          this.filterField.requestInfo = this.childData
          this.$refs.pagination.getTableListData()
        })
      }
    },
  },
  methods: {
    getTableList(data) {
      this.tableList = data
      this.loading = false
      if (this.tableList.length < 1) {
        this.isShow = true
      }
    },
    handleClose(index) {
      if (this.showTask) {
        this.showTask = false
      }
      this.$emit('callback', { success: true })
    },
    submit() {
      if (this.showTask) {
        this.showTask = false
      }
      this.$emit('callback', { success: true })
    },
  },
}
</script>
<style lang="less" scoped></style>
